import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;

public class Test {
    public static void main(String[] args) {

        testEqual();
    }


    public static void testEqual() {
        String a = "abc";

        System.out.println(System.identityHashCode(a));
        System.out.println(System.identityHashCode("abc"));
        System.out.println("abc" == a);
        a.intern();
        System.out.println("abc" == a);

    }


    public static void testStringLen() {

        String s1 = "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789";
        StringBuffer s = new StringBuffer();
        for (int i = 1; i < Integer.MAX_VALUE; i++) {
            if (i % 100 == 0) {
                System.gc();
            }
            s.append(s1);
            System.out.printf("%d %d\n", i, s.length());
            // 427819000
            //unsigned in 最大 = 4294967295
        }
    }


    public static void testGC() {
        ArrayList<Integer> integerArrayList = new ArrayList<>(10000);
        TreeSet<Integer> integerTreeSet = new TreeSet<>();
        HashSet<Integer> integerHashSet = new HashSet<>(10000);
        TreeMap<String, Integer> integerTreeMap = new TreeMap<>();
        HashMap<String, Integer> integerHashMap = new HashMap<>(10000);
        Hashtable<String, Integer> integerHashtable = new Hashtable<>(4444);
        CopyOnWriteArrayList<Integer> integerCopyOnWriteArrayList = new CopyOnWriteArrayList<>();
        System.gc();
        Byte b = (byte) 127;
        double d = 1.000000010001001001;
        System.out.println(d);
        String str = "a,b,c,,";
        String[] ary = str.split(",");
        StringBuilder str1 = new StringBuilder(str);
        System.out.println(ary.length);
        for (int i = 0; i < 100; i++) {
            str1.append(i);
        }
        System.gc();
        System.out.println(str1);
    }

}
